#!/bin/bash

if [ ! -d /home/"$1"/.ssh ]
then
   mkdir /home/"$1"/.ssh
fi
chmod 755 /home/"$1"/.ssh
g=`id -gn $1`
chown root.$g /home/"$1"/.ssh
if [ ! -f /home/"$1"/.ssh/authorized_keys2 ]
then
  touch /home/"$1"/.ssh/authorized_keys2
  chown "$1"."$g" /home/"$1"/.ssh/authorized_keys2
fi

/bin/cp /etc/ssh/sshrc /home/"$1"/.ssh/rc
chown root.root /home/"$1"/.ssh/rc
chmod 644 /home/"$1"/.ssh/rc
exit 0
